<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="jt" uri="http://www.jsoft.org/tags/jsoft"%>
<%@ taglib prefix="jh" uri="http://www.jsoft.org/tags/jsoft-html"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	if(path!=null&&path.equals("/")){
	   path="";
	} 
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<title>所有管理员列表</title>
		<link href="<%=basePath%>admin/styles/default.css" rel="stylesheet"
			type="text/css" />
		<link href="<%=basePath%>admin/styles/page.css" rel="stylesheet"
			type="text/css" />
		<script type="text/javascript">
		function editor(id,username,name,state)
		{
			document.all.id_txt.innerHTML = id;
			document.all.id.value = id;
			document.all.username.value = username;
			document.all.name.value = name;
			document.all.state.value = state;
		}
		function form_reset()
		{
			document.all.id_txt.innerHTML = "新增管理员";
			return true;
		}
		function form_delete(href)
		{
			if(confirm("您确定要删除吗？执行删除后数据将无法恢复！"))
			{
   				window.location.href = href;
   			}
		}
		</script>
	</head>

	<body>
		<div class="title">
			<h2>
				系统管理员列表
			</h2>
		</div>
		<div id="container">
			<!-- table -->
			<div id="info">
				<form action="<%=basePath%>manager/admin/save.do" method="post">
					<table width="100%" cellpadding="3" cellspacing="1" border="0" bgcolor="#e3e3e3">
						<tr bgcolor="#FFFFFF">
							<td width="100" nowrap="nowrap" bgcolor="#f7fbff">编号</td>
							<td>
								<font color="bule" id="id_txt">${requestScope.editAdmin.id}</font>
								<input type="hidden" name="id" id="id" value="${requestScope.editAdmin.id}" />
							</td>
							<td width="100" nowrap="nowrap" bgcolor="#f7fbff">状态</td>
							<td>
								<select name="state" id="state">
									<option value="1" <c:if test="${requestScope.editAdmin.state eq 1}">selected="selected"</c:if>>- 有效 -</option>
									<option value="0" <c:if test="${requestScope.editAdmin.state eq 0}">selected="selected"</c:if>>- 无效 -</option>
								</select>
							</td>
							<td colspan="2" nowrap="nowrap">
								<input type="submit" value="保存/修改" class="button" />
								<input type="reset" value="重置" class="button" />
								<input type="button" value="重新添加" class="button" onclick="window.location.href='<%=basePath%>manager/admin/list.do';" />
								<input type="hidden" name="page" value="${requestScope.PAGEMODEL.pageNum}"/>
							</td>
						</tr>
						<tr bgcolor="#FFFFFF">
							<td width="100" nowrap="nowrap" bgcolor="#f7fbff">用户名</td>
							<td>
								<input name="username" id="username" type="text" class="text" value="${requestScope.editAdmin.loginName}" />
							</td>
							<td width="100" nowrap="nowrap" bgcolor="#f7fbff">
								密码
								<input type="checkbox" name="updatePwd" value="1"/>
							</td>
							<td>
								<input name="password" type="password" class="text" />
							</td>
							<td width="100" nowrap="nowrap" bgcolor="#f7fbff">昵称</td>
							<td>
								<input name="name" id="name" type="text" class="text" value="${requestScope.editAdmin.name}" />
							</td>
						</tr>
					</table>
				</form>
				<div style="height: 10px;"></div>
			</div>
			<table class="table01">
				<tr>
					<th>编号</th>
					<th>用户名</th>
					<th>昵称</th>
					<th>注册时间</th>
					<th>注册IP</th>
					<th>状态</th>
					<th width="70">操作</th>
				</tr>
				<c:forEach items="${requestScope.adminList}" var="admin">
				<tr <c:if test="${requestScope.editAdmin.id eq admin.id}">class="selected"</c:if>>
					<td><c:out value="${admin.id}"/></td>
					<td><c:out value="${admin.loginName}"/></td>
					<td><c:out value="${admin.name}"/></td>
					<td><jt:date date="${admin.regTime}"/></td>
					<td><c:out value="${admin.regIp}"/></td>
					<td>
						<c:if test="${admin.state eq 1}"><font color="blue">有效</font></c:if>
						<c:if test="${admin.state eq 0}"><font color="red">无效</font></c:if>
						(<c:out value="${admin.state}"/>)
					</td>
					<td>
						<!-- javascript:editor('${admin.id}','${admin.loginName}','${admin.name}','${admin.state}'); -->
						<a href="<%=basePath%>manager/admin/edit.do?id=${admin.id}&page=${requestScope.PAGEMODEL.pageNum}">修改</a>
						<a href="javascript:form_delete('<%=basePath%>manager/admin/delete.do?id=${admin.id}');">删除</a>
					</td>
				</tr>
				</c:forEach>
			</table>
			<jt:page/>
		</div>
	</body>
</html>
